package cn.com.guage.dtm.api.list.stream;

import java.util.ArrayList;
import java.util.List;

public class ListForEachExample {
    public static void main(String[] args) {
        List<String> names = new ArrayList<>();
        names.add("Alice");
        names.add("Bob");
        names.add("Charlie");
        names.forEach(System.out::print);
        System.out.println("------");
        names.forEach(System.out::println);
        System.out.println("------");
        names.forEach(name -> System.out.println(name));
        names.forEach(name -> System.out.print(name + " "));
    }
}
